package com.wzy.business.store.main

import android.app.Activity
import android.content.Context
import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.activity.viewModels
import com.wangzhenyu.common.base.BaseActivity
import com.wangzhenyu.common.base.BaseVBPActivity
import com.wangzhenyu.common.base.bean.ApplyShopInfo
import com.wangzhenyu.common.base.bean.BindBankCardDTO
import com.wangzhenyu.common.base.bean.UserManager
import com.wzy.business.R
import com.wzy.business.databinding.ActivityApplyShopInfoBinding
import com.wzy.business.store.main.bean.BankCard
import com.wzy.business.store.main.bean.IDCard
import com.wzy.business.store.main.bean.License
import com.wzy.business.store.main.presenter.ApplyShopInfoPresenter
import com.wzy.business.store.main.presenter.impl.ApplyShopInfoPresenterImpl

class ApplyShopInfoActivity :
    BaseVBPActivity<ActivityApplyShopInfoBinding, ApplyShopInfoPresenter>(),
    ApplyShopInfoPresenter.View {


    companion object {

        //营业执照
        const val LICENSE = 0

        //税务登记证照片
        const val TAXES = 1

        //组织机构代码证照片
        const val ORGAN = 2

        //店铺门头照片（内景）
        const val SHOP_FRONT = 3

        //上传身份证照片
        const val ID_CARD_FRONT = 4

        //上传其他照片
        const val OTHER_PIC = 5

        //开户许可证照片
        const val PICTURE_COMPANY_ACCOUNT = 6

        //银行卡正面照
        const val PICTURE_PERSONAL_ACCOUNT = 7

        //食品卫生许可证照片
        const val FOOD_ALLOW = 8

        //商户签约承诺函
        const val AUTHOR_PIC = 9

        //店铺租聘合同
        const val HIRE = 10

        //个人申请时店铺照片
        const val PERSONAL_SHOP = 11

        fun openActivity(context: Context, type: Boolean) {
            if (context is Activity) {
                val intent = Intent(context, ApplyShopInfoActivity::class.java)
                intent.putExtra("type", type)
                context.startActivity(intent)
            }
        }

    }

    private val viewModel by viewModels<ApplyShopInfoViewModel>()

    override fun onShopInfoSuccess(applyShopInfo: ApplyShopInfo) {

    }

    override fun onShopInfoError(code: Int) {

    }

    override fun onApplyShopInfoSuccess() {

    }

    override fun onApplyShopInfoError(code: String?) {

    }

    override fun onBankCard(data: BankCard) {

    }

    override fun onIDCardG(data: IDCard) {

    }

    override fun onIDCardP(data: IDCard) {

    }

    override fun onUpdateLicense(data: License) {

    }

    override fun updateBankList(company: BindBankCardDTO?, personal: BindBankCardDTO?) {

    }

    override fun bindAccountYes() {

    }

    override fun bindAccountNO() {

    }

    override fun updateCompanyBank(name: String?, code: String?) {

    }

    override fun updatePersonalBank(name: String?, code: String?) {

    }

    override fun getViewBinding() = ActivityApplyShopInfoBinding.inflate(layoutInflater)

    override fun createPresenter() = ApplyShopInfoPresenterImpl(this, this)

    override fun useLightMode() = false

    override fun initBundles() {
        super.initBundles()
        viewModel.shopOpenOrNot = intent.getBooleanExtra("type", false)
    }

    override fun initView() {


        initObserver()
        val loginInfo = UserManager.getLoginInfo()


        loginInfo.apply {

            //直接申请店铺吧
            viewModel.firstApplyShop = true


        }


    }

    private fun initObserver() {
        //修改页面title
        viewModel.title.observe(this) {
            mToolBarDelegate?.setMidTitle(it)
        }

        //
    }

}